<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'frontend.main.class.php');
$feObj = new FrontendMainBase();

//
$types = array('announcement', 'content', 'news', 'page');
if( in_array($type, $types) ) {
	include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'module/' . $type . '/' . $type . '.comment.class.php');
	$classname = ucfirst($type) . 'CommentBase';
	$mObj = new $classname();
	$mObj->format = true;
	$mObj->setOwner($id);
	
	//
	if( $request_link_class == '' ) {
		$mObj->setQueryLimitLength(20);
		$items = $mObj->getItems('', 0);
		
		$feObj->content_wrap['items'] = $items;
	} else {
		$item = $mObj->getItem($request_link_class, 'link');
		
		$feObj->addInject('mainpart', 'item');
		$feObj->addInject('item', $item);
	}
}

//
if( $frame == '1' ) {
	echo $feObj->display('pagelayout/pagelayout_main_comment_frame.tpl');
} else {
	echo $feObj->display('pagelayout/pagelayout_main_comment.tpl');
}
//
?>